Skip to content

feat(scan): unit suffixes for reachability timeout/memory limits (1.1.123, Coana 15.5.0)#1369

Merged
Martin Torp (mtorp) merged 4 commits into
v1.xfrom
martin/cli-reachability-units
Jun 19, 2026
Merged

feat(scan): unit suffixes for reachability timeout/memory limits (1.1.123, Coana 15.5.0)#1369
Martin Torp (mtorp) merged 4 commits into
v1.xfrom
martin/cli-reachability-units

Conversation

@mtorp

@mtorp Martin Torp (mtorp) commented Jun 18, 2026

Copy link
Copy Markdown
Contributor

Summary

Adds unit suffixes to the reachability analysis options on socket scan create --reach and socket scan reach:

  • --reach-analysis-timeout accepts s, m, h (e.g. 90s, 10m, 1h)
  • --reach-analysis-memory-limit accepts MB, GB (e.g. 512MB, 8GB)

Units are case-insensitive. Coana (@coana-tech/cli) is the sole validator and parser of these values, so the CLI forwards the raw string through verbatim instead of coercing it to a number (both flags changed from meow type: 'number' to 'string') — matching the Socket Python CLI. socket-cli does not pre-validate the grammar, so a single source of truth can't drift; an invalid unit surfaces as Coana's error.

Backward compatibility

  • Bare numbers still work (seconds / MB) but are no longer documented.
  • Empty or zero-magnitude values are omitted when forwarding, so Coana applies its own defaults — preserving the prior numeric-0 "use default" sentinel.

Coana bump

Bumps the bundled Coana CLI to 15.5.0, whose parser understands these unit suffixes (the feature is inert on older Coana, which predates the parser). Package version bumped to 1.1.123 with a changelog entry.

Testing

  • pnpm run check:tsc — clean
  • pnpm run check:lint — clean
  • Reachability scan suites pass: verbatim forwarding to Coana, empty/zero → omit sentinel, default-equivalence detection for the --reach guard (incl. unit-equivalent defaults like 8GB/8192MB), help text, full scan create / scan reach.

Related

Part of the cross-CLI "reachability units" effort; validation lives only in Coana:

  • Docs: SocketDev/docs#32
  • Coana parser: @coana-tech/cli 15.5.0 (merged + published)
  • Socket Python CLI: pure passthrough (same model)

….123, Coana 15.5.0)

--reach-analysis-timeout and --reach-analysis-memory-limit now accept unit
suffixes (s/m/h for duration, MB/GB for memory, case-insensitive). Coana owns
the canonical parsing, so the CLI forwards the raw string verbatim instead of
coercing to a number. A thin local validator gives fast errors before the Coana
binary is spawned.

Empty or zero-magnitude values are omitted when forwarding so Coana applies its
own defaults, preserving the prior numeric-0 sentinel. Bare numbers keep working
but are no longer documented. Bumps the bundled Coana CLI to 15.5.0, whose parser
handles these units.

@cursor cursor Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Cursor Bugbot has reviewed your changes using high effort and found 1 potential issue.

Fix All in Cursor

Bugbot Autofix is ON. A cloud agent has been kicked off to fix the reported issue.

Comment @cursor review or bugbot run to trigger another review on this PR

Reviewed by Cursor Bugbot for commit bd1d761. Configure here.

Comment thread src/commands/scan/cmd-scan-create.mts Outdated
…-reach guard

The "reachability flags require --reach" guard compared the raw flag strings to
the default string, so unit-equivalent inputs were wrongly flagged as non-default
and rejected without --reach: 8GB / 8192MB (= the 8192MB default) and the
zero/omit timeout sentinel 0 / 0s. The latter was a regression from the
number→string change (numeric 0 used to equal the numeric default).

Compare by resolved magnitude instead: reachMemoryLimitToMb normalizes
8192/8192MB/8GB to 8192, and the timeout uses the omit sentinel so any zero
counts as default.
…ty-units

# Conflicts:
#	src/commands/scan/perform-reachability-analysis.test.mts
Coana (@coana-tech/cli) is now the sole validator/parser of the
--reach-analysis-timeout and --reach-analysis-memory-limit values, matching the
Python CLI. Removes the local grammar mirror (isValid* regex fast-fail) that had
already drifted from Coana twice (unit case-sensitivity, and a whitespace gap
where Coana trims but the mirror did not). An invalid unit now surfaces as
Coana's error instead of a fast local one.

Kept the non-validation helpers, which Coana does not model: isOmittedReachValue
(empty/zero -> omit the flag so Coana applies its default) and reachMemoryLimitToMb
(unit-agnostic default-equivalence for the "requires --reach" guard). The raw
string is still forwarded to Coana verbatim.
@mtorp Martin Torp (mtorp) merged commit 5675a51 into v1.x Jun 19, 2026
12 checks passed
@mtorp Martin Torp (mtorp) deleted the martin/cli-reachability-units branch June 19, 2026 07:24
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Development

Successfully merging this pull request may close these issues.

2 participants